/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package multiface.promonet.jpa;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author diego
 */
@Entity
@Table(name = "discussione")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Discussione.findAll", query = "SELECT d FROM Discussione d"),
    @NamedQuery(name = "Discussione.findByIddiscussione", query = "SELECT d FROM Discussione d WHERE d.iddiscussione = :iddiscussione"),
    @NamedQuery(name = "Discussione.findByNome", query = "SELECT d FROM Discussione d WHERE d.nome = :nome"),
    @NamedQuery(name = "Discussione.findByData", query = "SELECT d FROM Discussione d WHERE d.data = :data")})
public class Discussione implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "iddiscussione")
    private Integer iddiscussione;
    @Column(name = "nome")
    private String nome;
    @Column(name = "data")
    @Temporal(TemporalType.TIMESTAMP)
    private Date data;
    @OneToMany(mappedBy = "discussione")
    private List<Messaggio> messaggioList;

    public Discussione() {
    }

    public Discussione(Integer iddiscussione) {
        this.iddiscussione = iddiscussione;
    }

    public Integer getIddiscussione() {
        return iddiscussione;
    }

    public void setIddiscussione(Integer iddiscussione) {
        this.iddiscussione = iddiscussione;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    @XmlTransient
    public List<Messaggio> getMessaggioList() {
        return messaggioList;
    }

    public void setMessaggioList(List<Messaggio> messaggioList) {
        this.messaggioList = messaggioList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iddiscussione != null ? iddiscussione.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Discussione)) {
            return false;
        }
        Discussione other = (Discussione) object;
        if ((this.iddiscussione == null && other.iddiscussione != null) || (this.iddiscussione != null && !this.iddiscussione.equals(other.iddiscussione))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "multiface.promonet.jpa.Discussione[ iddiscussione=" + iddiscussione + " ]";
    }
    
}
